package com.itheima.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.entity.PermissionGroup;
import com.itheima.entity.R4Dto;
import com.itheima.mapper.PermissionGroupMapper;
import com.itheima.service.PermissionGroupService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

@Service
public class PermissionGroupServiceImpl extends ServiceImpl<PermissionGroupMapper, PermissionGroup> implements PermissionGroupService {

    @Override
    public List<R4Dto> simple() {
        List<PermissionGroup> permissionGroupList = this.list();
        List<R4Dto> list1 = new ArrayList<>();
        for (PermissionGroup permissionGroup : permissionGroupList) {
            R4Dto r4Dto = new R4Dto();
            Long id = permissionGroup.getId();
            r4Dto.setId(id);
            Random random = new Random();
            int nextInt = random.nextInt(1000);
            r4Dto.setTitle(nextInt+"");
            list1.add(r4Dto);
        }

        return list1;
    }
}